# 循环语句

# while
num = 3;
tot = 0;
while num > 0:
    tot += num;
    print(tot);
    num -= 1;
else:
    print('循环结束');

# for
# lists = [1, 3, 5, 7, 9]; # 列表
# lists = (1, 3, 5, 7, 9); # 元组
# lists = {1, 3, 5, 7, 9}; # 集合
lists = {
    "username" : "user1",
    "passwd" : "123"
}; # 字典

for i in lists:
    print(i);
    # print(lists[i]); # 集合
else:
    print('循环结束');

# while 九九乘法表
i = 1;
while i <= 9:
    j = 1;
    while j <= i:
        print('{0}*{1}={2}'.format(j, i, j*i), end = ' ');
        j += 1;
    i += 1;
    print();

# for 九九乘法表

for i in range(1, 10):
    for j in range(1, i+1):
        print('{0}*{1}={2}'.format(j, i, j*i), end = ' ');
    print();
